<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<HEAD>

  <TITLE>CS810 -- Advanced Programming in the UNIX Environment</TITLE>
  <STYLE type="text/css">
  body {
  background-color: #FFFFFf;
  }
  </STYLE>
  <STYLE type="text/css">
  li.c1 {list-style: none}
  </STYLE>

</HEAD>

<BODY>
  <TABLE border="1" align="center" cellpadding="15">
    <TR>
      <TD valign="top">
        <H2>CS810 -- Advanced Programming in the UNIX Environment - Fall 2010 - HW#4</H2>

        <H3>HW#4: patch ls(1) to add an option</H3>

        <H4>Summary</H4>
	<p>The objective of this assignment is for you to create a patch
        to add a new option to an existing tool.  In the process, you will
        learn to use <tt>cvs(1)</tt>, <tt>patch(1)</tt>, <tt>diff(1)</tt>
        and <tt>make</tt>.
	</p>
	<h4>Problem assignment</h4>
	<p>Modify the NetBSD <tt>ls(1)</tt> command to accept the
        "<tt>-O</tt>" flag as specified below:
        </p>
        <blockquote><verbatim>

-O      If combined with long (-l) output, print the optimal file I/O<br>
        blocksize right after printing the file size.

        </verbatim></blockquote>
        <p>
        To achieve this, you will retrieve the sources to NetBSD's
        <tt>ls(1)</tt> command via anonymous CVS access, make the
        appropriate changes and use the <tt>diff(1)</tt> utility to create
        a patch.
        </p>
       
	<h4>Deliverables and Due Date</H4>
        <p>Your homework submission will consist of a tar archive containing
        exactly two files: <tt>&lt;username&gt;/Makefile</tt> and
        <tt>&lt;username&gt;/patch</tt> (where "&lt;username&gt;" is of course
        your username).
        </p>
        <p>
        After extracting the archive, you can do the following:
<blockquote><verbatim>
cd &lt;username&gt;<br>
make
</verbatim></blockquote>
        </p>
        <p>
        As a result, there will be a new binary 'ls' (&lt;username&gt;/ls/ls) that will
        support the given option.
        </p>
        <p>
        In other words, running 'make' will fetch the sources to NetBSD's ls(1)
        command via anonymous CVS access, apply the patch in the given directory
        and then build the binary.  As any useful Makefile, only the steps
        actually necessary will be performed.
        </p>
        <p>
        Your homework will be graded based on this functionality, not only the
        code changes you make.
        </p>
        <p>
        The due date for this assignment is 2010-12-10 10:00.  Please
        attach the file to an email sent from your <tt>@stevens.edu</tt>
        email address to <a
        href="mailto:jschauma@cs.stevens.edu?subject=[CS810] HW4">jschauma@cs.stevens.edu</a>
        with a subject of "[CS810] HW4".
        </p>
        <hr>
	<p>
	You can find a partial sample solution <a
	href="jschauma-hw4.tar">here</a>.  The patch does not contain the
	requested functionality, but shows you the parts necessary to port the
	software to Linux.  The more important part is the Makefile, which
	only invokes any commands if they are actually necessary.
	</p>
        <hr>
        [<a href="index.html">Course Website</a>]
</BODY>
</HTML>
